package com.myk.game.heroscuffle.skills;

import com.myk.game.heroscuffle.game.Hero;
import com.myk.game.heroscuffle.game.Skill;
import com.myk.game.heroscuffle.utils.RdmPropUtil;

import java.util.List;

public class Skill_GanLin extends Skill {

    private static final int HEALING_BASE_AMOUNT = 15; //基础治疗量
    private static final int HEALING_OWN_AMOUNT = 30; //对自己的治疗量
    private static final int ATK_FILL_ADD = 5;  //攻击力的增加量

    public Skill_GanLin() {
        super("甘霖",
                "永久增加自己的攻击力，同时恢复场上所有英雄少量生命值。",
                2, 5);
    }

    @Override
    protected void onTrigger() {
        game.ui.printMsg("召唤甘雨泽惠万生...");
        game.ui.sleepShortly();
        //治疗所有英雄
        List<Hero> heroList = game.pool.getAllAliveHeroes();
        for (Hero hero : heroList) {
            if (hero != hostHero) { //给敌人加血
                if (hero.hp < hero.HP) { //非满血才打印恢复信息
                    game.ui.printlnMsg(hero.getObviousName());
                    hero.addHpWithPrint(HEALING_BASE_AMOUNT);
                }
            }
            else { //轮到自己时加血又加功
                game.ui.printlnMsg(hero.getObviousName());
                if (hero.hp < hero.HP) { //满血就不打印恢复信息
                    hero.addHpWithPrint(HEALING_OWN_AMOUNT); //自己恢复治疗
                }
                hero.addAtkWithPrint(ATK_FILL_ADD); //自己增加攻击力
            }
            game.ui.sleepShortly();
        }
    }

    @Override
    protected void onUpdate() {

    }

    @Override
    protected void onInit() {
        remnantCoolingTime = 0;
    }
}
